import Polyglot from 'node-polyglot'

export const translations = {
    'en_US': {
        kubernetes_cluster_basic_information: 'Kubernetes Cluster Basic Information',
        deploy_changes_to_kubernetes_cluster: 'Deploy changes to Kubernetes cluster',
        print_the_current_task_execution_result: 'Print the current task execution result',
        failed_to_obtain_kubernetes_certificate_file: 'Failed to obtain a valid Kubernetes certificate file. Please check the pipeline configuration and try again',
        apply_manifests_definition_file: 'Prepare to apply Manifests definition file',
        create_cache_directory_for_publishing_resources: 'Create a cache directory for publishing resources {{manifest}}',
        yaml_template_processed_successfully: 'YAML template processed successfully {{pathToYaml}} -> {{manifest}}',
        all_deployment_resources: 'All deployment resources:',
        no_published_resources_found: 'No published resources found, please check YAML path configuration',
        list_of_resources_to_be_released: 'List of resources to be released online soon',
        yaml_definition_of_online_resources: 'YAML Definition of Online Resources',
        clean_up_the_cache_directory: 'Clean up the cache directory for publishing resources {{manifest}}',
    },
    'zh_CN': {
        kubernetes_cluster_basic_information: 'Kubernetes集群基本信息',
        deploy_changes_to_kubernetes_cluster: '部署变更到Kubernetes集群',
        print_the_current_task_execution_result: '打印当前任务执行结果',
        failed_to_obtain_kubernetes_certificate_file: '未获取到合法的Kubernetes证书文件，请检查流水线配置后再试',
        apply_manifests_definition_file: '准备应用Manifests定义文件',
        create_cache_directory_for_publishing_resources: '创建发布资源缓存目录{{manifest}}',
        yaml_template_processed_successfully: 'YAML模板处理成功 {{pathToYaml}} -> {{manifest}}',
        all_deployment_resources: '所有部署资源：',
        no_published_resources_found: '没有找到发布的资源，请检查YAML路径配置',
        list_of_resources_to_be_released: '即将发布到线上的资源列表',
        yaml_definition_of_online_resources: '线上资源YAML定义',
        clean_up_the_cache_directory: '清理发布资源缓存目录{{manifest}}',
    }
}

const locale = process.env['PIPELINE_LOCALE'] === 'zh_CN' ? 'zh_CN' : 'en_US'
export const polyglot = new Polyglot({
    interpolation: {prefix: '{{', suffix: '}}'},
    phrases: translations[locale]
})